package com.wuhunyu;

/**
 * 测试主类
 *
 * @author gongzhiqiang
 * @version 1.0
 * @date 2021/6/23 19:24
 */

public class Test {

    public static void main(String[] args) throws ClassNotFoundException {
        System.out.println(Test.class.getClassLoader());    // sun.misc.Launcher$AppClassLoader@18b4aac2
        MyClassLoader myClassLoader = new MyClassLoader();
        System.out.println(myClassLoader.getClass().getClassLoader());  // sun.misc.Launcher$AppClassLoader@18b4aac2
        Class<?> user = myClassLoader.loadClass("User");
        System.out.println(user.getClassLoader());  // main.com.wuhunyu.MyClassLoader@1540e19d
        System.out.println(user.getClassLoader().getParent().getClass().getClassLoader());  // null
    }

}